package users;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

import papers.Manuscript;
/**
 * An author user that submits papers
 * @author Taylor Zielske
 * @version 10.20.2011
 */
public class Author extends User{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<Manuscript> my_manuscripts;
	/* @ assignable my_manuscripts @ */
	/* @ ensures my_manuscripts.size() == 0 @ */
	/**
	 * Creates a new Author user.
	 * @param name The name of this user.
	 * @param email The email address of this user.
	 */
	public Author(String user) {
		super(user);
		my_manuscripts = new ArrayList<Manuscript>();
	}
	/* @ requires the_manuscript != null */
	/* @ ensures my_manuscripts.size() == \old(my_manuscripts).size() + 1 @ */
	/** 
	 * Add manuscript to the author's list of manuscripts.
	 */
	public void addManuscript(Manuscript the_manuscript){
		my_manuscripts.add(the_manuscript);	
	}
	/* @ pure @ */
	/** 
	 * @return All the manuscripts submitted by this author
	 *  as an unmodifiable list.
	 */
	public List<Manuscript> getManuscripts(){
		return Collections.unmodifiableList(my_manuscripts);
	}	
	/**
	 * Returns Author.
	 */
	public String getRole(){
		return "Author";
	}
	/**
	 * Delete paper from list of papers.
	 * @param paper
	 */
	public void delete(Manuscript paper){
		my_manuscripts.remove(paper);
	}


}
